//
//  FCChartView.h
//  ZSXFirstChartDemo
//
//  Created by 邹时新 on 2018/6/12.
//  Copyright © 2018年 zoushixin. All rights reserved.
//

#import <UIKit/UIKit.h>
//#import "FCChartCollectionViewCell.h"


typedef enum : NSUInteger
{
    FCChartViewTypeSectionAndRowFixation,   ///< 行列固定
    FCChartViewTypeOnlySectionFixation,     ///< 行固定
    FCChartViewTypeOnlyRowFixation,         ///< 列固定
    FCChartViewTypeNoFixation,              ///< 无固定
} FCChartViewType;


typedef enum : NSUInteger
{
    FCChartCollectionViewTypeMain,          ///< 非悬浮主区域
    FCChartCollectionViewTypeSuspendRow,    ///< 悬浮列区域 
    FCChartCollectionViewTypeSuspendSection,    ///< 悬浮行区域 (头)
} FCChartCollectionViewType;


@class FCChartView;
@protocol FCChartViewDataSource <NSObject>

@required

/// 得到行数
/// @param chartView chartView description
/// @param section section description
- (NSInteger)chartView:(FCChartView *_Nullable)chartView numberOfItemsInSection:(NSInteger)section;

/// 加载右边视图item
/// @param collectionViewCell collectionViewCell description
/// @param type 悬浮类型
/// @param indexPath indexPath description
- (__kindof UICollectionViewCell *_Nullable)collectionViewCell:(UICollectionViewCell *_Nullable)collectionViewCell collectionViewType:(FCChartCollectionViewType)type cellForItemAtIndexPath:(NSIndexPath *_Nullable)indexPath;

/// 对应item尺寸大小
/// @param chartView chartView description
/// @param indexPath indexPath description
- (CGSize)chartView:(FCChartView *_Nullable)chartView sizeForItemAtIndexPath:(NSIndexPath *_Nullable)indexPath;

/// 总列数量 默认为1
/// @param chartView chartView description
- (NSInteger)numberOfSectionsInChartView:(FCChartView *_Nullable)chartView;



@optional

/// 悬浮锁定列数
/// @param chartView chartView description
- (NSInteger)numberOfSuspendSectionsInChartView:(FCChartView *_Nullable)chartView;


/**
 悬浮锁定行数

 @param chartView 当前对象
 @param section 第几列
 @return 行数
 */
- (NSInteger)chartView:(FCChartView *_Nullable)chartView numberOfSuspendItemsInSection:(NSInteger)section;


@end


@interface FCChartView : UIView

/// 初始化
/// @param frame frame description
/// @param type 行列固定方式类型
/// @param dataSource dataSource description
- (instancetype _Nullable )initWithFrame:(CGRect)frame type:(FCChartViewType)type dataSource:(id<FCChartViewDataSource>_Nullable)dataSource;

/// 注册
/// @param cellClass cellClass description
- (void)registerClass:(nullable Class)cellClass;

@property (nonatomic, weak)id <FCChartViewDataSource> _Nullable dataSource;



/**
 行悬浮区域颜色 默认灰色
 */
@property (nonatomic, strong, nullable) UIColor *suspendRowColor;

/**
 列悬浮区域颜色 默认灰色
 */
@property (nonatomic, strong, nullable) UIColor *suspendSectionColor;

/**
 主区域颜色
 */
@property (nonatomic, strong, nullable) UIColor *mainColor;


/**
 重新加载
 */
- (void)reload;



@end
